package happychat;

import java.net.InetAddress;

public class GetIP {

	public static void main(String[] args) throws Exception {
		InetAddress addr = InetAddress.getLocalHost();
		String ip = addr.getHostAddress();// 获得本机IP
		String address = addr.getHostName();// 获得本机名称
		System.out.println(ip);
		System.out.println(address);
	}
}